class Animal:
    def __init__(self, name, age, sex, legNum, weight):
        self.__name = name
        self.__age = age
        self.__sex = sex
        self.__legNum = legNum
        self.__weight = weight

    def eating(self, food):
        print(f"Animal eating ")

    def __str__(self):
        return f"名字: {self.__name}, 年龄: {self.__age} 性别: {self.__sex}, 腿的数量: {self.__legNum}, 体重: {self.__weight}"

   
if __name__ == '__main__':
    ani = Animal('动物', 2, '雄性', 4, 6)
    ani.eating("食物")
    print(ani)


    class Chicken(Animal):

        def __init__(self, name, age, sex, legNum, weight, combColor):
            super().__init__(name, age, sex, legNum, weight)
            self.__combColor = combColor

        def eating(self, food):
            print(f'鸡啄食{food}。')

        def flying(self):
            print('Chicken flying…')

        def __str__(self):
            str_sup = super().__str__()
            return str_sup + f"鸡冠颜色: {self.__combColor}"


    if __name__ == '__main__':
        chicken = Chicken('土鸡', 3, '公', 2, 2, '红色')
        chicken.eating('小虫')
        chicken.flying()
        print(chicken)